package nc.bs.pub.formularparse;

import java.util.Stack;

import nc.vo.pub.formulaset.core.ParseException;
import nc.vo.pub.formulaset.function.PostfixMathCommand;
import nc.vo.pub.lang.UFDouble;




public class ToDoubleFunc extends PostfixMathCommand {

	/**
	 * 
	 */
	public ToDoubleFunc() {
		numberOfParameters = 1;
	}
	
	
	/* (non-Javadoc)
	 * @see org.nfunk.jep.function.PostfixMathCommandI#run(java.util.Stack)
	 */
	public void run(Stack st) throws ParseException {
		checkStack(st);
		
		Object v1 = st.pop();
		UFDouble val = ( v1==null  || v1.toString().trim().equals(""))?new UFDouble(0.00):new UFDouble(v1.toString());
	    st.push(val);
	}
}
